----------------------------------Spell Variables--------------------------------------
SPELL.m_iSpellID = 30 -- Whatever value you want as long as it doesn't override any other spells' IDs.
SPELL.m_iRange = 240
SPELL.m_sName = "Pummel"
SPELL.m_sToolTip = [[A brutal strike with your fists 
					that deals 50% weapon 
					damage and silences the target.]]
SPELL.m_sIcon = "devin/blackbetty/spells/warrior/pummel.png"
SPELL.m_iCoolDown = 15
SPELL.m_bRequiresTarget = true
SPELL.m_iSpellType = SPELLTYPE_UTLITY

---------------------------------------------------------------------------------------

local range = 100
local weapondamage = 20

function SPELL:Cast( pl, target )
	print("Casted "..self.m_sName.."!")
	local dmginfo = DamageInfo()
		dmginfo:SetDamage( 5 ) --50 damage
		dmginfo:SetDamageType( DMG_SLASH ) --Bullet damage
		dmginfo:SetAttacker( pl ) --First player found gets credit
		dmginfo:SetDamageForce( Vector( 0, 0, 1000 ) ) --Launch upwards
		
	if(target && target:IsValid() && target != pl) then
		pl:SetNWString("HoldType", "melee")
		pl:DoAnimationEvent(ACT_HL2MP_GESTURE_RANGE_ATTACK_MELEE)
		pl:EmitSound("devin/blackbetty/weapons/swing/2h_"..math.random(1,3)..".wav", 100, 100+math.random(-10,10))
			
		timer.Simple(0.15, function()
			if(pl:GetPos():Distance(target:GetPos()) < range)then
				pl:EmitSound("devin/blackbetty/weapons/pummel/pummel.wav", 100, 100+math.random(-10,10))
				ParticleEffect( "pummel_hit", target:GetPos() + Vector(0, 0, 64) + (target:GetAngles():Forward()*24), Angle(0,0,0), pl )
				if(SERVER)then
					target:TakeDamageInfo( dmginfo )
					pl:SetNWBool("Casting", false)
					pl:SetNWBool("Casted", false)
				end
			end
		end)
		timer.Simple(0.75, function()
			pl:SetNWString("HoldType", "melee2")
		end)
	end
end



